Ranking and unranking permutations in linear time
نویسندگان
چکیده
منابع مشابه
Ranking and unranking permutations in linear time
A ranking function for the permutations on n symbols assigns a unique integer in the range [0, n! − 1] to each of the n! permutations. The corresponding unranking function is the inverse: given an integer between 0 and n! − 1, the value of the function is the permutation having this rank. We present simple ranking and unranking algorithms for permutations that can be computed using O(n) arithme...
متن کاملLinear-Time Ranking of Permutations
A lexicographic ranking function for the set of all permutations of n ordered symbols translates permutations to their ranks in the lexicographic order of all permutations. This is frequently used for indexing data structures by permutations. We present algorithms for computing both the ranking function and its inverse using O(n) arithmetic operations.
متن کاملRanking and Unranking of Hereditarily Finite Functions and Permutations
Prolog’s ability to return multiple answers on backtracking provides an elegant mechanism to derive reversible encodings of combinatorial objects as Natural Numbers i.e. ranking and unranking functions. Starting from a generalization of Ackerman’s encoding of Hereditarily Finite Sets with Urelements and a novel tupling/untupling operation, we derive encodings for Finite Functions and use them a...
متن کاملRanking and Unranking Left Szilard Languages
We give efficient ranking and unranking algorithms for left Szilard languages of context-free grammars. If O(n2) time and space preprocessing is allowed then each ranking operation is possible in linear time. Unranking takes time O(n log n). These algorithms imply similar algorithms for context-free languages generated by arbitrary unambiguous context-free grammars.
متن کاملGeneration, Ranking and Unranking of Ordered Trees with Degree Bounds
We study the problem of generating, ranking and unranking of unlabeled ordered trees whose nodes have maximum degree of ∆. This class of trees represents a generalization of chemical trees. A chemical tree is an unlabeled tree in which no node has degree greater than 4. By allowing up to ∆ children for each node of chemical tree instead of 4, we will have a generalization of chemical trees. Her...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
ژورنال
عنوان ژورنال: Information Processing Letters
سال: 2001
ISSN: 0020-0190
DOI: 10.1016/s0020-0190(01)00141-7